<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@include file="header.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Add User</title>
<link rel="stylesheet" type="text/css" href="<%=contextPath %>/admin/common.css">
<style>
.form-invalid {
background-color:#FFFFFF;
/*background-image:url(../images/invalid_line.gif);*/
border-color:#CC3300;
}
</style>
</head>
<body>
<script>
$(document).ready(function(){
	$("#passwordcfg").blur( function(){ 		 
		var form = document.getElementById("addUserForm");
		if ( form.password.value != form.passwordcfg.value){	
			$("#passwordcfgLbl").attr("innerText","两次输入密码不正确");	
			$("#passwordcfg").addClass("form-invalid");	
		}		
	} );
	$("#passwordcfg").click( function(){ 		 
		var form = document.getElementById("addUserForm");
		if ( form.password.value != form.passwordcfg.value){	
			$("#passwordcfgLbl").attr("innerText","两次输入密码不正确");	
			$("#passwordcfg").removeClass("form-invalid");	
		}		
	} );	
}
);
	function checkAndSubmit(){
		var form = document.getElementById("addUserForm");
		if ( form.name.value == ""){
			alert("用户账号不能为空");
			form.name.focus();
			return false;
		}
		if ( form.password.value != form.passwordcfg.value){
			alert("两次输入密码不正确");
			form.password.focus();
			return false;
		}
		form.submit();
	}
</script>  
<div align="center">新增用户</div>
<form method="post" action="userAdd.action" id="addUserForm">

<table width="80%" border="0" cellpadding="3" cellspacing="1"  bgcolor="#FFFFFF" align="center">
	<tr>
		<td class="tdbgcolor1" >用户账号:</td>
		<td class="tdbgcolor1" ><input type="text" name="userBean.name" id="name"></td>
	</tr>
	<tr>
		<td class="tdbgcolor2" >密码:</td>
		<td class="tdbgcolor2"><input type="password" name="userBean.password" id="password"></td>
	</tr>
	<tr>
	<td class="tdbgcolor1" >确认密码:</td>
		<td class="tdbgcolor1"><input type="password" name="passwordcfg" id="passwordcfg" ><label id="passwordcfgLbl" name="passwordcfgLbl"></label></td>
	</tr>	
	<tr>
		<td class="tdbgcolor2" >类别:</td>
		<td class="tdbgcolor2" ><select name="userBean.level" id="level">
			<option value="1">管理员</option>
			<option value="2">员工</option>
		</select></td>
	</tr>
	<tr>

		<td colspan="2" class="tdbgcolor1"><input type="button" value="Save"  onclick="checkAndSubmit()"/>&nbsp;<input
			type="button" value="reset" />
			&nbsp;
			<input	type="button" value="返回"  onclick="javascript:window.history.back();" />
			</td>
</table>
</form>
</body>
</html>
